package com.boot.rocketmq.producer;


import com.boot.rocketmq.message.DemoTopicMessage;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description:  测试消息重试
 * @Author:lkz
 * @Date:
 **/
@Component
public class Demo04Producer {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    public SendResult syncSend(Integer id) {
        // 创建 Demo04Message 消息
        DemoTopicMessage message = new DemoTopicMessage();
        message.setId(id);
        // 同步发送消息
        return rocketMQTemplate.syncSend(DemoTopicMessage.TOPIC_04, message);
    }


}
